import 'package:richedit/data/text_entity.dart';

textEntityFromJson(TextEntity data, Map<String, dynamic> json) {
	if (json['name'] != null) {
		data.name = json['name'].toString();
	}
	if (json['data'] != null) {
		data.data = json['data'].toString();
	}
	if (json['color'] != null) {
		data.color = json['color'].toString();
	}
	if (json['fontSize'] != null) {
		data.fontSize = json['fontSize'].toString();
	}
	if (json['bold'] != null) {
		data.bold = json['bold'];
	}
	if (json['italic'] != null) {
		data.italic = json['italic'];
	}
	if (json['align'] != null) {
		data.align = json['align'].toString();
	}
	return data;
}

Map<String, dynamic> textEntityToJson(TextEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['name'] = entity.name;
	data['data'] = entity.data;
	data['color'] = entity.color;
	data['fontSize'] = entity.fontSize;
	data['bold'] = entity.bold;
	data['italic'] = entity.italic;
	data['align'] = entity.align;
	return data;
}